package HomeWork;
/* 1.创建一个arraList集合,并添加以下字符串,字符串中前面是姓名 ,后面是年龄
 *  "zhangsn,23"
 *  "lisi,24"
 *  "wangwu,25"
 *  保留年龄大于24岁的,并将结果收集到map集合中,姓名为建,年龄为值*/
import java.util.ArrayList;
import java.util.Collections;
import java.util.Map;
import java.util.function.Function;
import java.util.stream.Collectors;

public class work01 {
    public static void main(String[] args) {
        ArrayList<String> list=new ArrayList<>();
        Collections.addAll(list, "张三,23","李四,24","王五,25");

        Map<String,Integer> map=list.stream().filter(t->Integer.parseInt(t.
                split(",")[1])>24).collect(Collectors.
                toMap(t->t.split(",")[0], t->Integer.
                        parseInt(t.split(",")[1])));
        System.out.println(map);
    }
}
